package com.xj.admin.bussiness.split;

public class split {

    public static void main(String[] args) {
        //1,数据库字段是这样的 假设这个是你数据库获取某对象的其中的字段
        String url = "http://xxx.cxx.com/image1,http://xxx.cxx.com/image1,http://xxx.cxx.com/image1";
        //2,获取以“，”分割开的数组
        String[] urlList = url.split(",");
        //3,假设这个对象是你前端要接收的对象
        ReturnObject returnObject = new ReturnObject();
        returnObject.setaUrl(urlList[0]);
        returnObject.setbUrl(urlList[1]);
        returnObject.setcUrl(urlList[2]);

        System.out.println(returnObject.toString());

        //4 把returnObject 对象返回给前端
        //5，模板中 用returnObject.aUrl 获取第1个url ，用returnObject.bUrl 获取第2个url，用returnObject.cUrl 获取第3个url
    }

    //前端返回的对象
    public static class ReturnObject{
        private  String aUrl;
        private  String bUrl;
        private  String cUrl;
        private  String dUrl;
        private  String eUrl;
        private  String fUrl;
        private  String gUrl;
        private  String hUrl;
        private  String iUrl;
        private  String jUrl;


        public String getaUrl() {
            return aUrl;
        }
        public void setaUrl(String aUrl) {
            this.aUrl = aUrl;
        }

        public String getbUrl() {
            return bUrl;
        }

        public void setbUrl(String bUrl) {
            this.bUrl = bUrl;
        }

        public String getcUrl() {
            return cUrl;
        }

        public void setcUrl(String cUrl) {
            this.cUrl = cUrl;
        }

        public String getdUrl() {
            return dUrl;
        }

        public void setdUrl(String dUrl) {
            this.dUrl = dUrl;
        }

        public String geteUrl() {
            return eUrl;
        }

        public void seteUrl(String eUrl) {
            this.eUrl = eUrl;
        }

        public String getfUrl() {
            return fUrl;
        }

        public void setfUrl(String fUrl) {
            this.fUrl = fUrl;
        }

        public String getgUrl() {
            return gUrl;
        }

        public void setgUrl(String gUrl) {
            this.gUrl = gUrl;
        }

        public String gethUrl() {
            return hUrl;
        }

        public void sethUrl(String hUrl) {
            this.hUrl = hUrl;
        }

        public String getiUrl() {
            return iUrl;
        }

        public void setiUrl(String iUrl) {
            this.iUrl = iUrl;
        }

        public String getjUrl() {
            return jUrl;
        }

        public void setjUrl(String jUrl) {
            this.jUrl = jUrl;
        }

        @Override
        public String toString() {
            return "ReturnObject{" +
                    "aUrl='" + aUrl + '\'' +
                    ", bUrl='" + bUrl + '\'' +
                    ", cUrl='" + cUrl + '\'' +
                    ", dUrl='" + dUrl + '\'' +
                    ", eUrl='" + eUrl + '\'' +
                    ", fUrl='" + fUrl + '\'' +
                    ", gUrl='" + gUrl + '\'' +
                    ", hUrl='" + hUrl + '\'' +
                    ", iUrl='" + iUrl + '\'' +
                    ", jUrl='" + jUrl + '\'' +
                    '}';
        }
    }

}
